package com.zkthink.ceres.promotion.enums;

import com.zkthink.exception.BizException;
import lombok.Getter;

/**
 * 优惠方案
 * @author vivi.wong
 * @return
 */
@Getter
public enum PromotionPlanEnum {

    PLUS_DISCOUNT(1,"叠加优惠"),
    LADDER_DISCOUNT(2, "阶梯优惠");

    private int code;

    private String desc;

    PromotionPlanEnum(int code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public static PromotionPlanEnum getPlan(Integer promotionPlan) {
        for (PromotionPlanEnum p: values()) {
            if (p.getCode() == promotionPlan.intValue()) {
                return p;
            }
        }
        throw new BizException("no support promotionPlan");
    }
}
